﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the GNU General Public License version 2 (GPLv2).
// See accompanying file License.txt or copy at http://phuse.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Phuse.Net.Forums
{
    /// <summary>Implements the common functionality of all <see cref="ISendReceiveProgress"/> implementations.
    /// </summary>
    /// <typeparam name="TMostDerived">The most-derived subclass of this type.</typeparam>
    /// <threadsafety static="true" instance="false"/>
    public abstract class SendReceiveProgress<TMostDerived> :
        Visitable<TMostDerived, ISendReceiveProgress>, ISendReceiveProgress
        where TMostDerived : SendReceiveProgress<TMostDerived>
    {
        private readonly int percent;

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>Gets how many percent of the operation have been completed.</summary>
        public int Percent
        {
            get { return this.percent; }
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal SendReceiveProgress(int percent)
        {
            this.percent = percent;
        }
    }
}
